<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <input type="text" v-model="t1">
  <input type="text" v-model="t2">
  <input type="button" value="加" @click="f('+')">
  <input type="button" value="减" @click="f('-')">
  <input type="button" value="乘" @click="f('*')">
  <input type="button" value="除" @click="f('/')">
  <h1>结果:{{info}}</h1>
</div>
<script src="js/vue.min.js"></script>
<script>
  let v= new Vue({
    el:"body>div",
    data:{
      info:"",
      t1:"",
      t2:""
    },
    methods:{
      f(x){
        if(isNaN(v.t1)||isNaN(v.t2)){
          v.info = "输入有误!"
          return;
        }
        v.info = eval(v.t1+x+v.t2)
      }
    }
  })
</script>
</body>
</html>